'use strict';

function average_to_letter(collection) {
  var str=['0','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
  'aa','ab','ac','ad','ae','af','ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap',
  'aq', 'ar', 'as', 'at', 'au', 'av', 'aw', 'ax', 'ay',
  'az', 'ba'
  ];
  //在这里写入代码
  var a=collection.reduce((a, b) => a + b) / collection.length
  var y = String(a).indexOf(".") + 1;//获取小数点的位置
  var count = String(a).length - y;//获取小数点后的个数
  if (y>0){
    a = Math.ceil(a)
  }
  return str[a];

}

module.exports = average_to_letter;

